<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .box {
            width: 400px;
            height: 400px;
            background: skyblue;
        }
    </style>
    <script src="jquery-3.2.1.min.js"></script>
    <script>
        $(function () {
            var k = 0;
            $('.box').click(function () {
                if ( k % 5 == 0 ) {
                    $(this).css('background','orange');
                } else if ( k % 5 == 1 ) {
                    $(this).css('background','purple');
                } else if ( k % 5 == 2 ) {
                    $(this).css('background','pink');
                } else if ( k % 5 == 3 ) {
                    $(this).css('background','red');
                }
                else {
                    $(this).css('background','skyblue');
                }
                k++;
            })
        })
    </script>
</head>
<body>
<div class="box"></div>
</body>
</html>